package tech.shupi.babytapmobile.database

import androidx.room.*

/**
 * Data Access Object for Card operations
 */
@Dao
interface CardDao {
    
    /**
     * Get all cards ordered by ID descending
     */
    @Query("SELECT * FROM cards ORDER BY id DESC")
    fun getAllCards(): List<CardEntity>
    
    /**
     * Get card by ID
     */
    @Query("SELECT * FROM cards WHERE id = :id")
    fun getCardById(id: Int): CardEntity?
    
    /**
     * Insert a new card
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertCard(card: CardEntity): Long
    
    /**
     * Update an existing card
     */
    @Update
    fun updateCard(card: CardEntity): Int
    
    /**
     * Delete a card by ID
     */
    @Query("DELETE FROM cards WHERE id = :id")
    fun deleteCardById(id: Int): Int
    
    /**
     * Delete all cards
     */
    @Query("DELETE FROM cards")
    fun deleteAllCards()
    
    /**
     * Get total count of cards
     */
    @Query("SELECT COUNT(*) FROM cards")
    fun getCardCount(): Int
    
    /**
     * Insert multiple cards
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertCards(cards: List<CardEntity>)
} 